package bit.springblogdemo.common.util;

import bit.springblogdemo.pojo.dataobject.BlogInfo;
import bit.springblogdemo.pojo.dataobject.UserInfo;
import bit.springblogdemo.pojo.response.BlogInfoResponse;
import bit.springblogdemo.pojo.response.UserInfoResponse;
import org.springframework.beans.BeanUtils;

public class BeanUtilTrans {

    public static BlogInfoResponse trans( BlogInfo blogInfo) {
//        if(blogInfo==null)
//            return null;
        BlogInfoResponse blogListResponse = new BlogInfoResponse();
        BeanUtils.copyProperties(blogInfo, blogListResponse);
        return blogListResponse;
    }

    public static UserInfoResponse trans(UserInfo userInfo) {
        UserInfoResponse userInfoResponse = new UserInfoResponse();
        BeanUtils.copyProperties(userInfo, userInfoResponse);
        return userInfoResponse;
    }
}
